import 'package:flutter/material.dart';

class MyApp10 extends StatelessWidget {
  const MyApp10({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        //导航条
        appBar: AppBar(
          title: const Text('Expanded组件',
              style: TextStyle(
                  fontSize: 20,
                  fontWeight: FontWeight.bold,
                  color: Colors.white)),
          backgroundColor: Colors.pink,
          centerTitle: true,
        ),
        //主体区域
        body: Center(
          child: Container(
            width: MediaQuery.of(context).size.width,
            height: 120,
            color: Colors.cyan,
            child: Row(
              children: [
                Expanded(
                  flex: 1,
                  child: Container(
                    height: 80,
                    color: Colors.red,
                    child: const Text('Expanded组件1'),
                  ),
                ),
                Expanded(
                  flex: 2,
                  child: Container(
                    height: 80,
                    color: Colors.green,
                    child: const Text('Expanded组件222222222222222222222222'),
                  ),
                ),
                Expanded(
                  flex: 1,
                  child: Container(
                    height: 80,
                    color: Colors.blue,
                    child: const Text('Expanded组件3'),
                  ),
                )
              ],
            ),
          ),
        ));
  }
}
